<?php


namespace app\backend\validate;


use think\Validate;

class SubjectValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'school_id' => 'require',
        'grade_id' => 'require',
        'major_id' => 'require',
        'degree_id' => 'require',
        'types_id' => 'require',
        'title' => 'require',
        'content' => 'require',
        'answer' => 'require',
        'name' => 'require',
        'status' => 'require',
        'sort' => 'require',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'school_id.require' => '请输入学校名称！',
        'grade_id.require' => '请输入所属年级！',
        'major_id.require' => '请输入所属专业！',
        'degree_id.require' => '请输入所属题型程度！',
        'types_id.require' => '请输入所属题型！',
        'title.require' => '请输入题目名称！',
        'content.require' => '请输入题目选项！',
        'answer.require' => '请输入题目答案！',
        'name.require' => '请输入出题人！',
        'status.require' => '请选择状态 1：显示 0：隐藏！',
        'sort.require' => '请输入排序！',
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'create' => ['name','status','sort','school_id','grade_id','major_id','degree_id','types_id','title','content','answer'],
        'update' => ['name','status','sort','school_id','grade_id','major_id','degree_id','types_id','title','content','answer']
    ];
}